package com.qkl.xiatang.app.dto.user;

import com.qkl.xiatang.app.utils.AppUtils;
import lombok.Data;
import org.apache.commons.lang3.ObjectUtils;

import java.util.List;

@Data
public class UserApproveWebDTO {

    private static final Integer STATUS_REFUSE = 0;

    private static final Integer STATUS_AGREE = 1;

    private String userId;

    private String companyId;

    /**
     * 0 拒绝,1 同意
     */
    private Integer approveStatus;

    private List<String> dutiesList;


    public boolean refuseStatus(){
        return STATUS_REFUSE.equals(approveStatus);
    }

    public boolean agreeStatus(){
        return STATUS_AGREE.equals(approveStatus);
    }

    public boolean statusOK(){
        return refuseStatus() || agreeStatus();
    }


    public String toDutiesStrings(){
        String result = "";
        List<String> list = AppUtils.stringsDistinct(dutiesList);
        if(ObjectUtils.isNotEmpty(list)){
            result  = String.join(",",list);
        }
        return result;
    }

}
